package com.waiter.moximoxi.adapter;

import android.content.Context;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.waiter.moximoxi.R;
import com.waiter.moximoxi.bean.MainTableListBean;

import java.util.List;

import cn.yhong.aframework.adapter.ZmAdapter;
import cn.yhong.aframework.adapter.ZmHolder;

/**
 * Created by 17639 on 2020/10/14.
 */

public class MainMenuAdapter extends ZmAdapter<MainTableListBean> {

    public MainMenuAdapter(Context mContext, List<MainTableListBean> itemList) {
        super(mContext, itemList);
    }

    @Override
    public void init(ZmHolder zmHolder, MainTableListBean mainTableListBean, int position) {
        LinearLayout main_item_ll = zmHolder.getView(R.id.main_item_ll);
        TextView main_item_num = zmHolder.getView(R.id.main_item_num);
        TextView main_item_state = zmHolder.getView(R.id.main_item_state);

        if (mainTableListBean.status == 4) {
            main_item_ll.setBackground(mContext.getResources().getDrawable(R.drawable.shape_solid_wait_10dp));
            main_item_state.setText("结账待清台");
        } else if (mainTableListBean.status == 3) {
            main_item_ll.setBackground(mContext.getResources().getDrawable(R.drawable.shape_solid_isopen_10dp));
            main_item_state.setText("已开台");
        } else if (mainTableListBean.status == 2 || mainTableListBean.status == 1) {
            main_item_ll.setBackground(mContext.getResources().getDrawable(R.drawable.shape_solid_empty_10dp));
            main_item_state.setText("空台");
        }
//        else if (mainTableListBean.status == 5) {
//            main_item_ll.setBackground(mContext.getResources().getDrawable(R.drawable.shape_solid_run_10dp));
//            main_item_state.setText("待清扫");
//        }

        main_item_num.setText(mainTableListBean.number);
    }

    @Override
    public int setLayout() {
        return R.layout.item_main_menu;
    }
}
